Skip to content

Migrate UI to Preact#218

Open
sorokya wants to merge 103 commits intomasterfrom
preact
Open

Migrate UI to Preact#218
sorokya wants to merge 103 commits intomasterfrom
preact

Conversation

@sorokya
Copy link
Copy Markdown
Owner

@sorokya sorokya commented Apr 5, 2026

No description provided.

@sorokya sorokya marked this pull request as ready for review April 18, 2026 01:57
sorokya and others added 29 commits April 17, 2026 22:00
… screens

- Move authentication and character selection logic into context and controllers
- Add new CharacterSelect, Login, and MainMenu UI containers with DaisyUI styling
- Refactor Button, Input, and add Checkbox component for consistent UI/UX
- Replace showError with alertController for error dialogs
- Improve modal accessibility (focus restore, Escape to close)
- Update connection/disconnect logic and GameState enum
- Update locale strings for new UI
- Delete dead exit-button.tsx (unused, not exported)
- Extract HUD_Z = 10 to hud/consts.ts, import in all HUD files
- Extract useExitGame() hook in nav-sidebar.tsx, DRY up NavSidebar + MobileNav
- Extract usePlayerStats() hook to use-player-stats.ts, shared by
  PlayerHud and StatsDialog (removes duplicated Stats type + subscription)
- Remove unused _tnl variable in player-hud.tsx
- Fix nested <button> inside <button> in chat-tab-bar.tsx (invalid HTML):
  outer tab is now a <div> wrapper, inner tab label and close button are
  proper sibling <button> elements
- Remove duplicated RESET_EVENT constant in use-dialog-layout.ts and
  window-manager.tsx — both now import from use-position.ts
- Fix window.innerWidth called during render in chat-dialog.tsx;
  use useViewport() so width reacts to resize events
- Remove dead l === 'manual' branch in dialog-base.tsx handleLayoutChange
  (AUTO_LAYOUT_OPTIONS never includes 'manual')
- Remove redundant tabMessages filter in chat-message-list.tsx; messages
  are already pre-filtered before being passed as a prop
- Exclude chat dialogs from autoLeft/Center/Right/manual layout groups
  in in-game.tsx to prevent potential double-rendering

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Delete chat-context-menu.tsx
- Strip context menu / long-press logic from ChatTabBar
- Remove setTabChannels from ChatManagerContextValue and provider

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add ProgressBar component to /ui/components (extracted from player-hud)
- Add generic Tabs component to /ui/components using daisyUI tabs classes
- Add 'class' prop to Button component for extra CSS classes
- Export ProgressBar and Tabs from components barrel
- player-hud: use imported ProgressBar; remove redundant JSX comments
- nav-sidebar: use Button for desktop + mobile hamburger; replace custom
  mobile dropdown with daisyUI menu
- settings-dialog: use Button component; remove wrapper div around text
- dialog-base: replace custom layout dropdown with daisyUI menu ul/li;
  remove redundant JSX comments
- chat-dialog: replace AddTabButton custom dropdown with daisyUI menu;
  remove section separator comments and Row 1/2/3 comments
- chat-tab-bar: replace custom dot with daisyUI status for unread indicator
- in-game.tsx: remove redundant Left/Center/Right layout group comments

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace all hardcoded white/rgba colors with consistent DaisyUI tokens:

Panel background: bg-base-300/90 backdrop-blur-sm (was bg-base-200/40
on dialogs vs bg-base-300/85 on mobile chat — now identical)

Border: border-base-content/10 (was border-white/10 everywhere — now
adapts to light/dark themes)

Section bars: bg-base-content/5 (was bg-white/5 in dialog title bars
and bg-base-300/60 in mobile chat tab bar)

Active/hover states: bg-base-content/20 and bg-base-content/10 (was
bg-white/20 and bg-white/10 in chat tabs and nav menu items)

Player HUD: bg-base-300/95 backdrop-blur-sm (was hardcoded
linear-gradient with rgba values)

Progress bar track: bg-black/45 ring-1 ring-inset ring-white/8 (was
inline style rgba — now uses Tailwind classes)

Menus: border border-base-content/10 (was border-base-200)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
formatTime now returns 'YYYY-MM-DD H:MM AM/PM' for messages from a
previous day, and 'H:MM AM/PM' as before for today's messages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Removed the overly strict `e.target !== canvas` guard on the window
click/contextmenu listeners. That check blocked game clicks whenever any
UI element (even the transparent #ui overlay) captured the event instead
of the canvas element itself.

The inner guard already in handleClick/handleRightClick correctly
filters clicks:
  - e.target === canvas  → allowed (canvas is not inside #ui)
  - e.target === #ui     → allowed (transparent overlay, short-circuits)
  - e.target inside #ui  → blocked (actual UI widget was clicked)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Extend usePlayerStats to include weight, maxWeight, and gold (item ID 1)
- Listen to both statsUpdate and inventoryChanged events
- Add weight as a progress bar in the HUD bar
- Add gold display with diamond icon (toLocaleString formatted)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Change ProgressBar label prop from string to ComponentChildren
- HP → GiHeartPlus (red), TP → GiBoltSpellCast (blue),
  TNL → GiStarMedal (amber), Weight → GiWeight (stone)
- Gold display uses GiCoins icon instead of diamond entity

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Move GfxLoader from Atlas (private) to Client (public gfxLoader field)
  so all UI code can load item graphics via client.gfxLoader
- Atlas now references this.client.gfxLoader instead of its own instance
- Add home and partner fields to Client; paperdoll handler populates
  them when the reply is for the local player
- Extend usePlayerStats to include title, home, partner, baseStats,
  secondaryStats; subscribe to equipmentChanged events
- Create ItemIcon component: loads item GFX via client.gfxLoader
  (GfxType.Items, resource = 100 + graphicId * 2), converts ImageBitmap
  to object URL with module-level cache, skeleton while loading
- Create InventoryGrid component: 8x10 grid, 2 tabs, ItemSize-aware
  cell spans, no-overlap first-fit placement, localStorage persistence,
  pointer-based drag & drop with ghost element, hover tooltips
- Create CharacterDialog (replaces StatsDialog): Paperdoll tab with
  character info and 15 equipment slots, Stats tab with base and
  derived stats, Book tab stub
- Update InventoryDialog to embed InventoryGrid
- Rename stats -> character throughout (window manager, dialog layout
  defaults, nav sidebar)
- Fix Tabs component: missing space before tab-active class
- Export ItemIcon and InventoryGrid from ui/components barrel

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix drag: replace setPointerCapture + div handlers with window event
  listeners via useEffect; use dragRef/activeTabRef to avoid stale closures
- Fix tryMoveToTab: search target tab directly instead of double findNextAvailable
- Fix tab active class: missing space before 'tab-active'
- Fix item class: missing space before 'opacity-30' conditional
- Fix tooltip: replace single-line data-tip with custom multiline group-hover div
- Fix double-click: call inventoryController.useItem(id) instead of early return
- Remove quantity label from inventory items
- Improve tab style: tabs-lifted with Roman numeral labels (I / II)
- Fix inventory dialog width: 200 → 220px to fit 184px grid with padding
- Paperdoll: side-by-side layout (equipment left, info right)
- Paperdoll: compact 32px equipment slots
- Add locale strings for all hardcoded labels in character dialog,
  equipment slots, stat labels, admin levels, and inventory tabs
- Use useLocale() throughout character-dialog and inventory-grid

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Right-aligned dialogs: increase pr-5 → pr-20 to avoid overlapping nav sidebar
- Inventory tooltips: format item amounts with toLocaleString() (e.g. 1,000,000)
- Equipment panel: replace data-tip single-line tooltips with custom multiline
  group-hover tooltips (same pattern as inventory grid)
- Equipment grid: replace flex layout with CSS grid (4 cols × 6 rows, 23px cells)
  with proper span positions:
    hat(col2,row1), necklace(col4,row1)
    weapon(col1,rows2-3,1×2), armor(cols2-3,rows2-3,2×2), shield(col4,rows2-3,1×2)
    gloves(col1,row4), belt(col2,row4), ring1(col3,row4), ring2(col4,row4)
    boots(col2,rows5-6,1×2), armlet1(col3,row5), armlet2(col4,row5)
    accessory(col1,row6), bracer1(col3,row6), bracer2(col4,row6)
- Paperdoll: capitalize player name and partner name using capitalize() utility
- Import EifRecord, capitalize, getItemMeta in character-dialog

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sorokya added 20 commits April 19, 2026 11:04
… actions on focused UI elements and improve drag-and-drop functionality with pointer events in various components.
…subscription methods for opened and updated events
…and prevent toast/chat emission for null messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant